
function event(func)
{
	this.happened = false;
	this.inprog = false;
	this.play = function (returndebug)
	{
		if (returndebug) DestroyPerson(thePC.name);	//remade on returntodebug()
		eval(func + "(" + returndebug + ");");
	}
}

var eventBox = new Array();	//HUGE!! Holds all events.

eventBox["introscene"] = new event("intro");
eventBox["prechase"] = new event("prechase_stuff");


function intro()
{
	eprep();
	ateq();
	msg01 = "  Not long ago,/w the struggling\n    battle of the Returners\n   redeemed the world to a\n    sophisticated paradise.";
	msg02 = "   A few years have passed.../w\n  wealth,/w freedom,/w and justice\n  have been rediscovered,/w and\n    high supremacy reigns..."
	msg03 = '     But there is one who\n   would enslave the world by\n  recovering his stolen virtue\n      known as "dignity."';
	msg04 = "     Can it be that those\n  seeking vengeance are on the\n     verge of repeating a\n  senseless and deadly mistake?";
							//Abort(msg01+"\n"+msg02+"\n"+msg03+"\n"+msg04);
	ateq("eventBox['introscene'].inprog = true;");
	ateq("blackout = true;");
	ateq("nowind = true;");
	ateq("ChangeMap('Doma.rmp');");
	ateq("bgmswitch('music/ff3war.it', false, true);");
	ateq("SetCameraX(500); SetCameraY(830);");
	ateq("fadeInScreen();");
	ateq("OMGCANTPressEnter = true;");
	ateq("winx = 45; maxdelay=200;");
	ateq("camerapany(350,1);");
	ateq("proceed=false; SetDelayScript(40, 'proceed=true;');");
	ateq("talkjunk(msg01);");
			//text finishes before camera pan, waits maxdelay frames before proceed
	ateq("proceed=false;");	//the pan proceeds
	ateq("fadeOutScreen();");

//--------
	ateq("blackout = true;");
	ateq("ChangeMap('Albrook.rmp');");
	ateq("SetCameraX(1050); SetCameraY(250);");
	ateq("OMGCANTPressEnter = true;");
	ateq("maxdelay=0;");	//dont clear text until second pan
	ateq("fadeInScreen();");
	ateq("camerapanx(700,1);");
	ateq("proceed = false; SetDelayScript(60, 'proceed=true;');");
	ateq("talkjunk(msg02);");

	ateq("camerapand(450,500,1);");
	ateq("maxdelay=80; sec_out_01=true; proceed=false;");
	ateq("proceed=false;");
	ateq("fadeOutScreen();");
//--------	
	ateq("blackout = true;");
	ateq("ChangeMap('Tzen.rmp');");
	ateq("SetCameraY(100);");
	ateq("proceed=false; SetDelayScript(40, 'proceed=true;');");
	ateq("fadeInScreen();");
	ateq("OMGCANTPressEnter = true;");
	ateq("maxdelay=200;");
	ateq("camerapany(550,1); ");
	ateq("proceed=false; SetDelayScript(40, 'proceed=true;');");
	ateq("talkjunk(msg03);");
	ateq("proceed=false;");
	ateq("fadeOutScreen();");
//-------	
	ateq("blackout = true;");
	ateq("ChangeMap('cliff.rmp');");
	ateq("SetCameraY(0);");
	
	ateq("vicks = new retard('vicks', 'Magitek.rss',true);");
	ateq("wedge = new retard('wedge', 'Magitek.rss',true);");
	ateq("wedge.step=0; wedge.mark=0; vicks.step=0; vicks.mark=0;");

	ateq("SetPersonX('vicks', 160); SetPersonY('vicks', 272);");
	ateq("SetPersonX('wedge', 190); SetPersonY('wedge', 272);");
	
	ateq("eventBox['introscene'].inprog = false;");
	ateq("maxdelay = 200;");
	ateq("fadeInScreen();");
	ateq("talkjunk(msg04);");
	ateq("delete msg01; delete msg02; delete msg03; delete msg04;");
	ateq("bgmswitch();");
	ateq("nowind = false;");
	ateq("winx = xbo;");
	
	ateq("wedge.dirs = new Array('fu','u','u','u','u','u','u','u','u','w','fl','l','w','w','l','l','w','w','proceed = true;');");
	ateq("vicks.dirs = new Array('fu','u','u','u','u','u','u','w','fl','w','l','w');");
	ateq("SetPersonScript('wedge', 4, 'walkgay(wedge, wedge.dirs[wedge.step]);');");
	ateq("proceed = false; SetPersonScript('vicks', 4, 'walkgay(vicks, vicks.dirs[vicks.step]);');");
	dial01 = "VICKS: There's the town...";
	dial02 = "WEDGE: Hard to believe that Kefka's been\nseen there, a few years after he was\nannihilated...";
	dial03 = "VICKS: Think he's still alive?\nWEDGE: Probably...\n...Judging from the popularity of the\nrumors.";
	dial04 = "VICKS: And this Kefka, this... maniac.\nWhy's he there?";
	dial05 = "I heard he escaped the tower before it\ncollapsed in under 3 minutes.";
	dial06 = "WEDGE: Not to worry. The sheer humiliation\nin his head robs him of all sane thought.\nHe's harmless.";
	dial07 = "WEDGE: We'll approach from the east.\nMove out!";
	ateq("talkjunk(dial01);");
	ateq("proceed = false; SetDelayScript(10, 'proceed = true;');");
	ateq("talkjunk(dial02);");
	ateq("proceed = false; vicks.step = 0; vicks.mark = 0; vicks.dirs = new Array('l','proceed = true;');");
	ateq("talkjunk(dial03);");
	ateq("SetPersonDirection('vicks', 'north');");
	ateq("talkjunk(dial04);");
	ateq("talkjunk(dial05);");
	ateq("proceed = false; SetPersonDirection('wedge', 'south'); SetDelayScript(10, 'proceed = true;');");
	ateq("talkjunk(dial06);");
	ateq("proceed = false; wedge.step = 0; wedge.mark = 0; wedge.dirs = new Array('dr','d','d','w','proceed = true;');");
	ateq("talkjunk(dial07);");
	
	ateq("delete dial01;");
	ateq("delete dial02;");
	ateq("delete dial03;");
	ateq("delete dial04;");
	ateq("delete dial05;");
	ateq("delete dial06;");
	ateq("delete dial07;");
	ateq("maxdelay = false;");
	ateq("OMGdontNeedToPressEnter = false;");
	ateq("wedge.step=0; wedge.mark=0; vicks.step=0; vicks.mark=0;");
	ateq("vicks.dirs = new Array('w','fr','r','r','fd','d','d','d','d','d','d');");
	ateq("proceed = false; wedge.dirs = new Array('w','d','d','d','d','d','d','d','proceed = true;');");	
	ateq("DestroyPerson('wedge'); DestroyPerson('vicks');");	//KILL!!!!!!!!
	ateq("fadeOutScreen();");
	ateq("eventBox['introscene'].inprog = false; eventinprog = false; game();");
	eventinprog = true; proceed = true;
}


function prechase_stuff()
{
	dostats(new Array("Smitty", 1, 62, 62, 0, 0, 32, 70, 35, 44, 51, 106, 32, 93, 5, 0, "Theif01.rss", "Face14.png"));
	dostats(new Array("Ziggy", 1, 62, 62, 0, 0, 32, 75, 35, 44, 51, 106, 32, 93, 5, 0, "Theif01.rss", "Face14.png"));
	
	eprep();
	ateq("");
	ateq("blackout = true;");
	ateq("eventBox['prechase'].inprog = true; timer.start();");
	ateq("ChangeMap('Albrook.rmp');");
	ateq("DetachInput(); DetachCamera();");
	ateq("DestroyPerson('speedracer'); DestroyPerson('slowracer'); DestroyPerson('pilot'); DestroyPerson('turtletrainer');");
	ateq("SetTile(13,9, 1, 1035); SetTile(14,9,1,1036); SetTile(51,112, 1, 130); SetTile(52,112,1,130); SetTile(69,95,1,319); SetTile(69,94,2,287);");
	ateq("SetTile(51,113,1,301); SetTile(52,113,1,301); SetTile(51,114,1,1304); SetTile(52,114,1,1304); SetTile(68,96,1,319); SetTile(68,95,2,287);");
	ateq("loader.dirs = new Array('w');");
	ateq("thePC = new retard('Smitty', 'Theif01.rss', false); party = new Array('Smitty'); SetPersonDirection(thePC.name, 'west'); IgnoreTileObstructions(thePC.name, true);");
	ateq("captain = new retard('captain', 'Captaincrash.rss', true); Ziggy=new retard('Ziggy', 'Theif01.rss', true);");
	ateq("SetPersonX(thePC.name, 765); SetPersonY(thePC.name,1825+32); SetPersonLayer(thePC.name, 1);")
	ateq("SetPersonX('captain', 56*16+7); SetPersonY('captain', 117*16+7); SetPersonDirection('captain', 'west');");
	ateq("SetPersonX('spect1', 777); SetPersonY('spect1', 1870+32); IgnorePersonObstructions('spect1', true);");
	ateq("SetPersonX('spect2', 698); SetPersonY('spect2', 1829+32); IgnorePersonObstructions('spect2', true);");
	ateq("SetPersonX('spect3', 805); SetPersonY('spect3', 1858); IgnorePersonObstructions('spect3', true);SetPersonX('Ziggy', 55*16+15); SetPersonY('Ziggy', 115*16+7);");
	
	ateq("SetCameraX(GetPersonX('oldfogey')); SetCameraY(1835+32);");
	ateq("bgmswitch('music/Albrook.it', true, true);");
	ateq("fadeInScreen();");
	ateq("proceed = false; SetDelayScript(20, 'proceed=true;');");
	ateq("proceed = false; camerapanx(829, 1);");
	ateq("SetPersonScript('spect3', 4, 'if (spect3.mark >= 8){spect3.step++; spect3.mark = 0;} walkgay(spect3, spect3.dirs[spect3.step]);');");
	ateq("proceed = false; spect3.dirs = new Array('fr','r','r','r','fu','u','SetPersonFrame(spect3.name,0);','w','w', 'proceed=true;'); spect3.step=0; spect3.mark=0;");
	ateq("getter('die.ogg').setPitch(1.75); getter('die.ogg').play(false);");
	ateq("SetTile(51,114,1,1370); SetTile(52,114,1,1371); SetTile(51,113,1,1370); SetTile(52,113,1,1371); SetTile(51,112,1,48);SetTile(52,112,1,49);");
	ateq("loader.dirs = new Array('fr','w','w','fl','w','l','l','l','l','fd','w','d','fl','l','l','l','l','l','l','w','w','w','fr','w','r','r','r','r','r','r','r','r','w','fu','w','u'); loader.step=0;loader.mark=0;");
	ateq("SetPersonScript('spect3', 4, 'if (spect3.step > spect3.dirs.length) spect3.step=0; walkgay(spect3, spect3.dirs[spect3.step]);');");
	ateq("spect3.dirs = new Array('SetPersonDirection(spect3.name,\"cast\");','w','SetPersonDirection(spect3.name,\"fight\");','w');");
	ateq("SetPersonScript('captain', 4, 'walkgay(captain, captain.dirs[captain.step]);');");
	ateq("proceed = false; captain.dirs = new Array('w','l','proceed=true;');");
	ateq("talkjunk(ghaoe);");
	ateq("proceed = false; SetDelayScript(30, 'proceed=true;');");
	ateq("talkjunk(dmetn);");
	ateq("proceed = false; SetDelayScript(40, 'proceed=true;');");
	ateq("talkjunk(omgg);");
	ateq("proceed = false; SetDelayScript(10, 'proceed=true;');");
	ateq("spect1.dirs = new Array('w'); spect2.dirs = new Array('w'); spect3.dirs = new Array('w');");
	ateq("SetPersonDirection('spect1', 'shock'); SetPersonDirection('spect2', 'shock'); SetPersonDirection('spect3','shock'); SetPersonDirection('Smitty','shock'); SetPersonDirection('Ziggy', 'shock');");
	ateq("proceed = false; SetDelayScript(25, 'proceed=true;');");
	ateq("SetPersonScript('spect1', 4, 'if (spect1.mark >= 8){spect1.step++; spect1.mark = 0;} walkgay(spect1, spect1.dirs[spect1.step]);');");
	ateq("SetPersonScript('spect2', 4, 'if (spect2.mark >= 8){spect2.step++; spect2.mark = 0;} walkgay(spect2, spect2.dirs[spect2.step]);');");
	ateq("SetPersonScript('spect3', 4, 'if (spect3.mark >= 8){spect3.step++; spect3.mark = 0;} walkgay(spect3, spect3.dirs[spect3.step]);');");
	ateq("SetPersonScript('Smitty', 4, 'if (thePC.mark >= 8){thePC.step++; thePC.mark = 0;} walkgay(thePC, thePC.dirs[thePC.step]);');");
	ateq("SetPersonScript('Ziggy', 4, 'walkgay(Ziggy, Ziggy.dirs[Ziggy.step]);');");
	ateq("SetPersonSpeed('spect1', 2); SetPersonSpeed('spect2', 2); SetPersonSpeed('spect3', 2); SetPersonSpeed('Smitty', 2); SetPersonDirection('Ziggy', 'south');");
	ateq("spect1.dirs = new Array('fr','r','r','r','r','r','fu','u','SetPersonFrame(spect1.name, 0);'); spect1.step=0; spect1.mark=0;");
	ateq("spect3.dirs = new Array('fd','d','fr','r','r','fd','SetPersonFrame(spect3.name, 0);'); spect3.step=0; spect3.mark=0;");
	ateq("thePC.dirs = new Array('fr','r','r','r','r','r','fd','IgnoreTileObstructions(thePC.name,false);', 'd','SetPersonFrame(thePC.name, 0);'); thePC.step=0; thePC.mark=0;");
	ateq("IgnoreTileObstructions('Ziggy', true); Ziggy.dirs = new Array('fl','l','fd','d','SetPersonFrame(Ziggy.name,0);'); Ziggy.step=0;");
	ateq("proceed = false; spect2.dirs = new Array('fr','r','r','r','dr','r','r','dr','r','r','r','r','fu','QueuePersonCommand(spect2.name,pcmu,false);','QueuePersonCommand(spect2.name,pcmu,false);','SetPersonFrame(spect2.name, 0);','proceed=true;'); spect2.step=0; spect2.mark=0;");
	ateq("talkjunk(vorta);");
	ateq("talkjunk(trsfad);");
	ateq("IgnorePersonObstructions(Ziggy.name, true);");
	ateq("Ziggy.dirs = new Array('fu','u','fl','l','SetPersonSpeed(Ziggy.name,2);','l','fu','u','u','fl','l','SetPersonSpeed(Ziggy.name,1);','l','l','l','l','l','l','l','l','l','l','l','u','u','u','u','u','u','fd','SetPersonFrame(Ziggy.name,0);'); Ziggy.mark=0; Ziggy.step=0;");
	ateq("SetPersonScript('Ziggy', 3, 'eventinprog=true; proceed = true;');");
	ateq("talkjunk(ghrat);");
	ateq("IgnoreTileObstructions(spect1.name,true); IgnoreTileObstructions(spect2.name,true); IgnoreTileObstructions(spect3.name,true);");
	ateq("SetPersonScript('spect2', 4, 'if (spect2.mark >= 4){spect2.step++; spect2.mark = 0;} walkgay(spect2, spect2.dirs[spect2.step]);');");
	ateq("SetPersonScript('Smitty', 4, 'walkgay(thePC, thePC.dirs[thePC.step]);'); SetPersonSpeed('Smitty',1);");
	ateq("spect3.dirs = new Array('fu','u','fl','l','l','fu','u','SetPersonDirection(spect4.name,\"south\");','u','u','u','u','u','fr','r','r','r','r','r','r','r','SetPersonDirection(spect4.name,\"flat\");SetPersonY(spect4.name,GetPersonY(spect4.name)+13); getter(\\'mute-1.ogg\\').play(false);','r','r','r','r','r', 'for (var k=0;k<5;k++)QueuePersonCommand(spect3.name,pcml,false);', 'for (var g=0;g<4;g++)QueuePersonCommand(spect3.name,pcmu,false);','SetPersonFrame(spect3.name,0);','SetPersonDirection(spect3.name,\"south\");'); spect3.step=0; spect3.mark=0;");
	ateq("spect2.dirs = new Array('ul','ul','u','u','fl','ul','l','l','fu','u','u','u','u','u','u','u','fr','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','SetPersonFrame(spect2.name,0);','SetPersonDirection(spect2.name,\"west\");'); spect2.step=0; spect2.mark=0;");
	ateq("spect1.dirs = new Array(';', ';', ';', ';', 'fd','for(var h=0;h<3;h++)QueuePersonCommand(spect1.name,pcmd,false);','fl','l','l','fu','u','u','u','u','u','u','u','fr','ur','ur','r','r','r','r','r','r','r','r', 'for (var g=0;g<3;g++) QueuePersonCommand(spect1.name,pcmr,false);', 'SetPersonFrame(spect1.name,0);','SetPersonDirection(spect1.name,\"south\");'); spect1.step=0; spect1.mark=0;");
	ateq("proceed = false; thePC.dirs = new Array('SetPersonDirection(thePC.name, \"nohands\");', 'w', 'SetPersonDirection(thePC.name, \"anger\");','w','proceed=true;'); thePC.step=0; thePC.mark=0;");
	ateq("proceed = false; thePC.dirs = new Array('SetPersonDirection(thePC.name, \"fight\");', 'w', 'SetPersonDirection(thePC.name, \"hurt\");','w','SetPersonDirection(thePC.name, \"fight\");', 'w', 'SetPersonDirection(thePC.name, \"hurt\");','w','SetPersonDirection(thePC.name, \"fight\");', 'w', 'proceed=true;'); thePC.step=0; thePC.mark=0;");
	ateq("proceed = false; thePC.dirs = new Array('SetPersonDirection(thePC.name, \"nohands\");', 'w','SetPersonDirection(thePC.name, \"anger\");','w','fd',';',';',';','SetPersonDirection(thePC.name, \"lookwest\");','w','fl','l','fu','proceed=true;','u'); thePC.step=0; thePC.mark=0;");
	ateq("winy = 170;");
	ateq("talkjunk(trops);");
	ateq("SetPersonDirection('Smitty', 'shock');");
	ateq("proceed = false; SetDelayScript(25, 'proceed=true;');");
	ateq("proceed=false; thePC.dirs = new Array('fd','d','fr','SetPersonFrame(thePC.name, 0);','proceed=true;'); thePC.step=0; thePC.mark=0;");
	ateq("talkjunk(graop);");
	ateq("captain.dirs = new Array('fr','r','ur','r','fl','SetPersonFrame(captain.name,0);'); captain.step=0; captain.mark=0;");
	ateq("proceed=false; SetDelayScript(15, 'proceed=true;');");
	ateq("winy = ybor; SetPersonDirection('Smitty', 'north');");
	ateq("SetPersonScript('spect4', 4, 'walkgay(spect4, spect4.dirs[spect4.step]);');");
	ateq("SetPersonDirection(spect4.name,\"south\"); spect4.dirs = new Array('fd','w','fl','w','fu','u','fl','w','l','w','l','w','l','w','l','w','l','w','l','w','l','w','l','w','l','w','l','SetPersonFrame(spect4.name,0);','w','fr'); spect4.step=0; spect4.mark=0;");
	ateq("SetPersonScript('captain', 3, 'talkjunk(\"CAPTAIN CRASH: Where be that rum?\");');");
	ateq("SetPersonScript('spect1', 3, 'talkjunk(\"PIRATE A: I say we start a turtle race!\");');");
	ateq("SetPersonScript('spect2', 3, 'talkjunk(\"PIRATE B: Time to con some old people!\");');");
	ateq("SetPersonScript('spect3', 3, 'talkjunk(\"PIRATE C: I saw a sea monster with terrible\\\\nhygene in the ocean!\");');");
	ateq("SetPersonScript('spect4', 3, 'talkjunk(\"OLDY: Filthy savages!\");'); spect4.talk2 = undefined;");
	
	ghaoe = "CAPTAIN CRASH: Avast m'hardys! The port\nof Albrook.";
	dmetn = "CAPTAIN CRASH: Mateys!";
	omgg = " ./w./w./w./wMATEYS!!";
	vorta = "CAPTAIN CRASH: Arrg, there be work to do.\nWe need customers for the next cruise.";
	trsfad = "CAPTAIN CRASH: Ziggy here will go and\nspread the word.";
	ghrat = "The rest of ye can do what ya like for\nnow.";
	trops = "CAPTAIN CRASH: Arr har! Not so fast!";
	graop = "CAPTAIN CRASH: You go fetch me some rum.\nI be all out.";
	
	dsafjb = "ZIGGY: Yarr, my homie. No need to risk\ntraveling alone. I'll join ya!";
	
	geez3 = "CASHIER: Sorry, we don't serve rum. Try\nthe pub.";
	black54 = "THIEF: Rum? Ain't seen none lately.\nYou want somethin' else anyway.";
	
	//"BARTENDER: The last of the rum was bought by that merchant up there.";
	//"MERCHANT: I gotta check out those dancers!";
	//"MERCHANT: You want my rum? Too bad!";
	//"PIRATE: Arr, I'll fight ya for it!";
	//"You received \"RUM\"!";
	//"DUNCAN: That rum is MINE!";
	//"DUNCAN: Hold/w./w./w./w *hic!*/w/w still!";
	//"ZIGGY: Yeah! The cap'n is gunna like this!\nLet's give'im the swag!";
	//"Smitty: Aye.";
	
	halby = "MERCHANT: I/w./w. hate/w./w. pirates/w...";
	ebtur = "BARTENDER: Uh.. I would have given you it\nfor free, of course..";
	sadd = "MTEK EXPERT: You can't operate a Magitek\nwhile under the influence, buddy. Gwah ha!";
	shmak = "TRAVELING SALESMAN: I STILL sell parts for \nMagitek Armor.";
	
	//"PIRATE: Look who's here!";
	//"CAPTAIN CRASH: Have ye completed yer\nerrand?";
	//"SMITTY: Yes, captain. A full bottle o' rum!";
	//"CRASH: HARR Harr! Bring it here!";
	
	
	ateq("initGame(true); eventinprog=true;");
	ateq("SetUpdateScript('prechaseupdate();');");
	ateq("thempa = 'Albrook.rmp'; people = GetPersonList();");
	ateq("eventinprog = 'pause'; proceed = false;");			//proceeds ontalk to ziggy
	ateq("SetPersonScript('Ziggy', 3, ';'); DetachInput(); DetachCamera();");
	ateq("talkjunk(dsafjb);");
	ateq("talkjunk('ZIGGY: Head fer th\\'pub to find tha booze.\');");
	ateq("IgnorePersonObstructions(Ziggy.name,true); for (var vr=0; vr<8; vr++) QueuePersonCommand(Ziggy.name, pcmd, false); QueuePersonScript(Ziggy.name, 'proceed=true;',false); proceed=false;");
	ateq("party.push(Ziggy.name); DestroyPerson(Ziggy.name); SetTile(68,97,1,181); SetTile(68,96,2,0);  people=GetPersonList();");
	ateq("proceed=false; SetDelayScript(20, 'proceed=true;');");
		//pan to the pub
	ateq("camerapand(23*16+7, 45*16+7, [2,9]); proceed=false;");
	ateq("proceed=false; SetDelayScript(35, 'proceed=true;');");
	ateq("SetTile(23, 42, 1, 428);SetTile(23, 41, 1, 397);SetTile(23, 41, 4, 1116); getter('door_open_sfx.wav').play(false);");
	ateq("stumbler = new retard('stumbler', 'Villager13.rss', true); SetPersonX('stumbler', 23*16+7); SetPersonY('stumbler', 40*16+7); SetPersonLayer('stumbler', 1);");
	ateq("SetPersonScript('stumbler', 4, 'walkgay(stumbler, stumbler.dirs[stumbler.step]);');");
	ateq("stumbler.dirs = ['fd','d','d','dr','fr','d','fd','dl','SetPersonDirection(\\'stumbler\\', \\'lookdown\\');', 'w', 'getter(\\'smack.ogg\\').play(false); SetPersonDirection(\\'stumbler\\', \\'deadnorth\\');', 'w','w', 'proceed=true']; proceed=false;");
	ateq("SetPersonScript('stumbler', 3, 'talkjunk(\"STUMBLES: attendancda  tend danc the galaetci gung athering festiveal..\");');");
	ateq("camerapand(GetPersonX('Smitty'), GetPersonY('Smitty'), [2,9]); proceed=false;");
	ateq("AttachInput(thePC.name); AttachCamera(thePC.name);");
	
	ateq("");
	ateq("proceed = false; eventinprog = 'pause';");	//should not proceed at all.. (used to proceed on pub enter)
	ateq("Abort('tree, you MORON!!');");
	//trashed all old subsequent/contiguous code, sectioned it into subevents
	eventinprog = true; proceed = true;

}

function pirate_merch_faceoff()
{
	SetPersonFrame(thePC.name, 0);
	SetPersonSpeed(thePC.name, 1);
	rumsbattle.proceed = false;
	if (GetPersonDirection(thePC.name) == "west")
	{
		QueuePersonCommand(thePC.name, pcfd, false);					//fd
		for (var p=0; p<((14*16+7) - GetPersonY(thePC.name)); p++)
			QueuePersonCommand(thePC.name, pcmd, false);				//md
		QueuePersonCommand(thePC.name, pcfl, false);					//fw
		for (var p=0; p<(GetPersonX(thePC.name) - (7*16+7)); p++)
			QueuePersonCommand(thePC.name, pcml, false);				//ww
		QueuePersonCommand(thePC.name, pcfu, false);					//fu
		for (var p=0; p<16; p++)
			QueuePersonCommand(thePC.name, pcmu, false);				//wu
		QueuePersonCommand(thePC.name, pcfr, false);					//fe
		QueuePersonScript(thePC.name, 'SetPersonFrame(thePC.name, 0);', false);
		QueuePersonScript(thePC.name, 'rumsbattle.proceed=true;', false);
	}
	else if (GetPersonDirection(thePC.name) == "south")
	{
		QueuePersonCommand(thePC.name, pcfl, false);
		for (var p=0; p<(GetPersonX(thePC.name) - (7*16+7)); p++)
			QueuePersonCommand(thePC.name, pcml, false);
		QueuePersonCommand(thePC.name, pcfd, false);
		for (var p=0; p<((13*16+7) - GetPersonY(thePC.name)); p++)
			QueuePersonCommand(thePC.name, pcmd, false);
		QueuePersonCommand(thePC.name, pcfr, false);
		QueuePersonScript(thePC.name, 'SetPersonFrame(thePC.name, 0);', false);
		QueuePersonScript(thePC.name, 'rumsbattle.proceed=true;', false);
	}
	else if (GetPersonDirection(thePC.name) == "north")
	{
		QueuePersonCommand(thePC.name, pcfl, false);
		for (var p=0; p<(GetPersonX(thePC.name) - (7*16+7)); p++)
			QueuePersonCommand(thePC.name, pcml, false);
		QueuePersonCommand(thePC.name, pcfu, false);
		for (var p=0; p<(GetPersonY(thePC.name) - (13*16+7)); p++)
			QueuePersonCommand(thePC.name, pcmu, false);
		QueuePersonCommand(thePC.name, pcfr, false);
		QueuePersonScript(thePC.name, 'SetPersonFrame(thePC.name, 0);', false);
		QueuePersonScript(thePC.name, 'rumsbattle.proceed=true;', false);
	}
	else //if (GetPersonDirection(thePC.name) == "east");
	{
		var alignyee = GetPersonY(thePC.name) - (13*16+7);
		if (alignyee == 0) {rumsbattle.proceed=true; return;}
		QueuePersonCommand(thePC.name, (alignyee > 0) ? pcfu : pcfd, false);
		for (var p=0; p<Math.abs(alignyee); p++)
			QueuePersonCommand(thePC.name, (alignyee > 0) ? pcmu : pcmd, false);
		QueuePersonCommand(thePC.name, pcfr, false);
		QueuePersonScript(thePC.name, 'SetPersonFrame(thePC.name, 0);', false);
		QueuePersonScript(thePC.name, 'rumsbattle.proceed=true;', false);
	}
}

function prechaseupdate()
{
	updation();
	if (thempa=="Albrook.rmp" && GetPersonX(thePC.name)>495 && GetPersonX(thePC.name)<790 && GetPersonY(thePC.name)>1420 && GetPersonY(thePC.name)<1500)
	{
		SetUpdateScript("updation();");
		brook_invasion.play();
	}
}

///  PRECHASE 2 !!!!





